home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / netprog.zip / NETPROG.TAR / select / timer.c < prev   
C/C++ Source or Header  |  1989-12-17  |  389b  |  20 lines

  1. #include    <sys/types.h>
  2. #include    <sys/time.h>
  3.  
  4. main(argc, argv)
  5. int    argc;
  6. char    *argv[];
  7. {
  8.     long            atol();
  9.     static struct timeval    timeout;
  10.  
  11.     if (argc != 3)
  12.         err_quit("usage: timer <#seconds> <#microseconds>");
  13.     timeout.tv_sec  = atol(argv[1]);
  14.     timeout.tv_usec = atol(argv[2]);
  15.  
  16.     if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &timeout) < 0)
  17.         err_sys("select error");
  18.     exit(0);
  19. }
  20.